package com.gupt.youhd.config;/*
@author name
@data 2023/5/10-11:29
*/

import java.io.FileWriter;
import java.io.IOException;

//支付的相关配置：
public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "9021000122696090";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjQzaZK4vgstRXJ0hm+69qx8WSAuISv6btbJb18C9Px6/dhTnNZE3956YDl9g6UVRusS0tIKnw+N6LOAu7raJKlCxNVzvyp7kQ/Dk9vuaUeDBrbaLc9aGt3mBXHl3VSk9Th6TuIC1XyEoQEgR4rEVMNZLL55re6ooAkRXrI1jYD/Zf5k4gDtahipgffGZcRuj8bPWBuYQruoTTkhP5E5kl9hJ/V/Nwy9x6SJ3jjqWa8sLM1jE0/3Ixi9N+BLuT1VLiOP5FCYWQ+H7VtO2StpyNpQO8smAlix9Uxl6WMd1hcDKVv9ps6f31FS7Ojx82mJ+SyqfmjeEEj74oiqLfM3zDwIDAQAB";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtt/6FpOx9XVH1HmgEdoRuXd1ZCCGGS3RxYZXa7Bp/rRGGTbiBK780HW0NhxaIF7PWojUand6pIGbOpnY30BoLqg8X6ChZ5XLY5Rizuhw82m4u5SqAAnU+vM6gCUqzEKbpAVZ9my1LK6nE+QGVJsjiuaLL4nqovG8b68VPHyBM6ndZxubSlBFfPb/5mDaxK6k9IeCd8T08GUVGjyWhmpRa4jyMl2nu1Q+gMpDxl5RwPbKsdjwZuf90LMb2nysZ38b3I8FA7iqL8oDo/EvOMP+LCv4Mub8x37jqbKP3I0V0940k/zmSTwvsHqwZKOqujimHcI+V14XWeFNnvgT2kaRhQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
